package 尚硅谷.juc.test14;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class CallableDemo {

    public static void main(String[] args) throws ExecutionException, InterruptedException {


        FutureTask<Integer> futureTask = new FutureTask<>(new MyThread2());
        Thread T1 = new Thread(futureTask, "AA");
        Thread T2 = new Thread(futureTask, "BB");
        T1.start();
        T2.start();
        /**
         * isDone（）方法：用来判断当前线程是否执行完毕
         *    false:未执行完  true：执行完毕
         */
        System.out.println(futureTask.isDone());
        Integer integer = futureTask.get();
        System.out.println(futureTask.isDone());
    }
}
